export const useSettingStore = defineStore("Setting", () => {
  const isSmallCollapse = ref(false);
  const isPhoneCollapse = ref(false);

  const toggleCollapse = () => {
    if (isPhoneCollapse.value) {
      // 手机模式时切换手机折叠状态
      isPhoneCollapse.value = false;
      isSmallCollapse.value = true;
    } else {
      // 桌面模式时切换桌面折叠状态
      isSmallCollapse.value = !isSmallCollapse.value;
    }
  };
  // 设置1280px折叠
  const setSmallCollapse = (val: boolean) => (isSmallCollapse.value = val);
  // 设置手机折叠
  const setPhoneCollapse = (val: boolean) => (isPhoneCollapse.value = val);

  return {
    isSmallCollapse,
    isPhoneCollapse,
    toggleCollapse,
    setSmallCollapse,
    setPhoneCollapse,
  };
});
